Skip to content

Conversation

@elachlan
Copy link
Contributor

Relates to #7174


UncPattern.IsMatch(winDirectory).ShouldBe(false);
UncPattern.IsMatch(unixDirectory).ShouldBe(false);
UncPattern.IsMatch(string.Empty).ShouldBe(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at all these tests, they don't really feel substantively different from each other, and many check the same thing twice. Maybe condense into one test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are those changes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Forgind I disagree pretty strongly with this recommendation, because it violates the test principle that a test should fail for only one reason. Here the new test could fail if one of the implementations fails but it wouldn't be super clear from the failure which one.

@elachlan don't bother reverting though; this isn't a huge deal and you already did the unification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. I was borderline on suggesting just removing the legacy tests entirely—they test Regex, which isn't even in MSBuild. FileUtilitiesRegex.IsUncPattern and FileUtilitiesRegex.StartsWithUncPattern both just call FileUtilitiesRegex.StartsWithUncPatternMatchLength, so it all felt like one test to me. It's possible that won't be true in the future, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to the team, I don't mind either way. Just let me know what you want me to do. If there isn't any changes then is this okay to merge?

Copy link
Contributor

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks about right to me 🙂


UncPattern.IsMatch(winDirectory).ShouldBe(false);
UncPattern.IsMatch(unixDirectory).ShouldBe(false);
UncPattern.IsMatch(string.Empty).ShouldBe(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Forgind I disagree pretty strongly with this recommendation, because it violates the test principle that a test should fail for only one reason. Here the new test could fail if one of the implementations fails but it wouldn't be super clear from the failure which one.

@elachlan don't bother reverting though; this isn't a huge deal and you already did the unification.

@ladipro ladipro added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Jan 25, 2022
@ladipro ladipro merged commit 5394d5a into dotnet:main Jan 26, 2022
@elachlan elachlan deleted the CA2241 branch January 26, 2022 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants